#include <conio.h>
#include <iostream.h>

void main(){

  clrscr();
  unsigned long n, a, b, f[50], j;
  int i, fv[50];

//afisarea numerelor fibonacci

  f[1]=1;
  f[2]=2;
  for(i=3; i<=46; i++) f[i]=f[i-2]+f[i-1];
  for(i=1; i<=23; i++)cout<<i<<" "<<f[i]<<endl;getch();
  for(i=23; i<=46; i++)cout<<i<<" "<<f[i]<<endl;

//descompunerea unui numar n in suma de numere fibonacci

  getch();
  cout<<"n=?";
  cin>>n;
  for(i=1; i<=46; i++) fv[i]=0;
  for(i=46; i>=1;i--) if(f[i]<=n){
			n=n-f[i];
			cout<<f[i]<<" ";
		      }
  cout<<endl;
  getch();

//vizualizarea numerelor de la a la b prin componentele fibonacci

  cout<<"a=";cin>>a;
  cout<<"b=";cin>>b;
  for(j=a; j<=b; j++){
    n=j;
  for(i=1; i<=46; i++) fv[i]=0;
  for(i=46; i>=1;i--) if(f[i]<=n){
			n=n-f[i];
                        fv[i]=1;
		      }
  for(i=46; i>=1;i--) cout<<fv[i];
  cout<<endl;
//  for(i=46; i>=1;i--) if(fv[i]) cout<<"Û"; else cout<<" ";
//  cout<<endl;
  }
  getch();

}